www.gusucode.com > 环保时代家庭财务管理系统 EPffms v4.0 > 环保时代家庭财务管理系统 EPffms v4.0\code\eptimehome\money_modi.asp

    <!-- #include file="conn.asp" -->
<%
'****************************************************
'Code for EptimeFFMS
'Vision : v4.0
'****************************************************
%>
<html>
<head>
<title>修改</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/admin.css" rel="stylesheet" type="text/css">
<style>
body {
	background-color:#FFFFFF;
}
</style>
</HEAD>
<BODY>
<%
if request("hid2")<>"" then
nowselldate=request("selldate")
nowtype=request("type")
nowold_type=request("old_type")
nowbigclass=request("bigclass")
nowsmallclass=request("smallclass")
nowprice=request("price")
if nowprice="" then
  nowprice=0
end if
nowold_price=request("old_price")
nowzhanghu=request("zhanghu")
nowold_zhanghu=request("old_zhanghu")
if nowold_price="" then
  nowold_price=0
end if

nowbeizhu=request("beizhu")
nowid_login=request("id_login")


set rs_login=conn.execute("select * from Eptime_admin where id="&nowid_login)

If(databaseType=0) Then 
sql="update Eptime_money set id_bigclass="&nowbigclass&",id_smallclass="&nowsmallclass&",zhanghu="&nowzhanghu&",type="&nowtype&",price="&nowprice&",beizhu='"&nowbeizhu&"',id_login="&nowid_login&",login='"&rs_login("username")&"',selldate=#"&nowselldate&"# where id="&request("id")
ElseIf(databaseType=1) Then
sql="update Eptime_money set id_bigclass="&nowbigclass&",id_smallclass="&nowsmallclass&",zhanghu="&nowzhanghu&",type="&nowtype&",price="&nowprice&",beizhu='"&nowbeizhu&"',id_login="&nowid_login&",login='"&rs_login("username")&"',selldate='"&nowselldate&"' where id="&request("id")
End If 

conn.execute(sql)

If nowtype="0" Then
sql="update Eptime_zhanghu set amount=amount+"&nowprice&" where id="&nowzhanghu
conn.execute(sql)
sql="update Eptime_zhanghu set amount=amount-"&nowold_price&" where id="&nowold_zhanghu
conn.execute(sql)
End If

If nowtype="1" Then
sql="update Eptime_zhanghu set amount=amount-"&nowprice&" where id="&nowzhanghu
conn.execute(sql)
sql="update Eptime_zhanghu set amount=amount+"&nowold_price&" where id="&nowold_zhanghu
conn.execute(sql)
End If
%>
<script language="javascript">
alert("修改成功!")
window.location.href="money.asp"
</script> 
<%
end if
%>
<script language="javascript">
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}

function check()
{
if (document.form3.price.value=="")
{
alert("有*号的必须填写!");
return false;
}
if (isNumberString(document.form3.price.value,"1234567890.")!=1)
{
alert("金额只能为数字!");
return false;
}
}
</script>
<%
set rs=conn.execute("select * from Eptime_money where id="&request("id"))

old_type=rs("type")&""
nowtype=request("type")
if nowtype="" then
  nowtype=old_type
end if
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="images/r_1.gif" alt="" /></td>
<td width="100%" background="images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;帐务修改(带*号的为必填项)</td>
	  <td align="right">&nbsp;<font color="#ff0000">修改流水账以后,系统会自动更新相关账户的余额和各项统计报表中的数据。</font></td>
    </tr>
  </table>
</td>
<td><img src="images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      <form name="form1">
	  <input type="hidden" name="id" value="<%=request("id")%>">
	
	  </form>
	  <form name="form2">
	  <input type="hidden" name="type" value="<%=nowtype%>">
	  <input type="hidden" name="id" value="<%=request("id")%>">
	  <tr>
        <td align="right" height="30">所属大类:</td>
        <td class="category">
    <%
	nowbigclass=request("bigclass")
	if nowbigclass="" then
	  nowbigclass=rs("id_bigclass")&""
	end if
	sql="select * from Eptime_money_bigclass where type="&nowtype&" order by id"
	set rs_bigclass=conn.execute(sql)
	if rs_bigclass.eof then
	%>
	<script language="javascript">
	  alert("请先添加帐务大类!")
	  window.location.href="../money/bigclass_add.asp"
	</script>
	<%
	  response.end
	end if
	nowbigclass=request("bigclass")
	if nowbigclass="" then
	  nowbigclass=rs("id_bigclass")&""
	end if
	%>
	  <select name="bigclass" onChange="form2.submit()">
        <%
	do while rs_bigclass.eof=false
	%>
        <option value="<%=rs_bigclass("id")%>"<%if trim(cstr(rs_bigclass("id")))=nowbigclass then%> selected="selected"<%end if%>><%=rs_bigclass("bigclass")%></option>
        <%
	  rs_bigclass.movenext
	loop
	%>
      </select>		  
		  </td>
      </tr>	
	  </form>
	  <form name="form3">
	  <input type="hidden" name="id" value="<%=request("id")%>"> 
	  <input type="hidden" name="bigclass" value="<%=nowbigclass%>">
	  <input type="hidden" name="type" value="<%=nowtype%>">
	  <input type="hidden" name="old_type" value="<%=old_type%>">
      <tr>
        <td align="right" height="30">所属小类:</td>
        <td class="category">
    <%
	sql="select * from Eptime_money_smallclass where id_bigclass="&nowbigclass&" order by id"
	set rs_smallclass=conn.execute(sql)
	%>
	  <select name="smallclass">
        <%
	do while rs_smallclass.eof=false
	%>
        <option value="<%=rs_smallclass("id")%>"<%if trim(cstr(rs_smallclass("id")))=rs("id_smallclass")&"" then%> selected="selected"<%end if%>><%=rs_smallclass("smallclass")%></option>
        <%
	  rs_smallclass.movenext
	loop
	%>
      </select>  
		  </td>
      </tr>  
      <tr>
        <td align="right" height="30">金额:</td>
        <td class="category"><input type="text" name="price" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" value="<%=rs("price")%>">
		  <input type="hidden" name="old_price" value="<%=rs("price")%>">
		  <font color="#666666">元</font>
		  <font color="#ff0000">*</font>
		</td>
      </tr>	

	  <tr>
	    <td align="right" height="30">时间:</td>
        <td class="category">
		  <input name="selldate" value="<%=rs("selldate")%>" readonly style="width:150px">
		  <img src="images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form3&field=selldate&oldDate='+selldate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=200,left=520');">
		</td>
      </tr>  
	  
	<tr>
        <td align="right" height="30">资金账户:</td>
        <td class="category">
		  <%
			sql="select * from Eptime_zhanghu order by id"
			set rs_zhanghu=conn.execute(sql)	  
		  if rs_zhanghu.eof then
		  %>
	      <script language="javascript">
	        alert("请先添加!")
	        window.location.href="admin_manager.asp"
	      </script>
		  <%
		  response.end
		  else
		  %>
		  <select name="zhanghu">
		  <%
		  do while rs_zhanghu.eof=false
		  %>
		    <option value="<%=rs_zhanghu("id")%>" <%if rs_zhanghu("id")=rs("zhanghu") then%> selected="selected"<%end if%>><%=rs_zhanghu("name")%> </option>
		  <%
		    rs_zhanghu.movenext
		  loop
		  %>
		  </select>
		  <%
		  end if
		  %>		
		  <input type="hidden" name="old_zhanghu" value="<%=rs("zhanghu")%>">
		  </td>
      </tr>	 


      <tr>
        <td align="right" height="30">家庭成员:</td>
        <td class="category">
		  <%

			sql="select * from Eptime_admin where working=1 "
			set rs_login=conn.execute(sql)	  

		  if rs_login.eof then
		  %>
	      <script language="javascript">
	        alert("请先添加员工!")
	        window.location.href=""
	      </script>
		  <%
		  response.end
		  else
		  %>
		  <select name="id_login">
		  <%
		  do while rs_login.eof=false
		  %>
		    <option value="<%=rs_login("id")%>"<%if rs_login("id")=rs("id_login") then%> selected="selected"<%end if%>><%=rs_login("realname")%></option>
		  <%
		    rs_login.movenext
		  loop
		  %>
		  </select>
		  <%
		  end if
		  %>		</td>
      </tr>	
      <tr>
        <td align="right" height="30">备注:</td>
        <td class="category">
          <textarea name="beizhu" cols="60" rows="3"><%=rs("beizhu")%></textarea>
        </td>
      </tr>	  	  
      <tr>
	    <td height="30">&nbsp;</td>
        <td class="category">
		  <input type="submit" value=" 确认修改 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
		  <input type="hidden" name="hid2" value="ok">
		  <input type="reset" value=" 重新填写 " class="button">		</td>
      </tr>
	  </form>
</table>	
</td>
<td></td>
</tr>
<tr>
<td><img src="images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="images/r_3.gif" alt="" /></td>
</tr>
</table>
</body>
</html>